﻿<phone:PhoneApplicationPage
    x:Class="ChinaUnicom.Views.LoginPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"    
    mc:Ignorable="d"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="False"
    toolkit:TiltEffect.IsTiltEnabled="True" d:DesignHeight="800" d:DesignWidth="480">

    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:SlideTransition Mode="SlideLeftFadeIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:SlideTransition Mode="SlideLeftFadeIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:SlideTransition Mode="SlideLeftFadeOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:SlideTransition Mode="SlideLeftFadeOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" >
            <Rectangle Style="{StaticResource PageTopRectangleStyle}"/>
            <Border Style="{StaticResource PageTopBorderStyle}">
                <TextBlock Text="联通助手" Style="{StaticResource PageTopTextStyle}"/>
            </Border>
        </StackPanel>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel Grid.Row="1" Margin="12,10,0,28">
            <TextBlock Text="登录" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="2">
            <Grid.Resources>
                <Style x:Key="PasswordHintStyle" TargetType="TextBlock">
                    <Setter Property="Width" Value="120"/>
                    <Setter Property="Height" Value="34"/>
                    <Setter Property="VerticalAlignment" Value="Center"/>
                    <Setter Property="HorizontalAlignment" Value="Left"/>
                    <Setter Property="Margin" Value="18,0,0,0"/>
                    <Setter Property="Foreground" Value="{StaticResource PhoneRadioCheckBoxCheckDisabledBrush}"/>
                    <Setter Property="FontSize" Value="24"/>
                </Style>
            </Grid.Resources>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="80"/>
            </Grid.RowDefinitions>
            <ScrollViewer Margin="12,0,12,0">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="50"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="50"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="50"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="20"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <TextBlock Text="手机号码" 
                               Grid.Row="0" 
                               VerticalAlignment="Bottom" />
                    <toolkit:PhoneTextBox Grid.Row="1" 
                                          Hint="手机号码" 
                                          Height="74"
                                          Text="{Binding Mobile, Mode=TwoWay}"
                                          InputScope="Number"
                                          TextChanged="OnMobileChanged"/>

                    <TextBlock Text="服务密码" 
                               Grid.Row="2" 
                               VerticalAlignment="Bottom" />
                    <PasswordBox x:Name="password" 
                                 Grid.Row="3" 
                                 Height="74" 
                                 GotFocus="OnPasswordGotFocus" 
                                 LostFocus="OnPasswordLostFocus"
                                 Password="{Binding Password, Mode=TwoWay}"/>
                    <TextBlock x:Name="passwordHint" 
                               Text="服务密码" 
                               Grid.Row="3" 
                               Style="{StaticResource PasswordHintStyle}"
                               Tap="OnPasswordHintTaped"/>

                    <TextBlock Text="验证码" 
                               Grid.Row="4" 
                               VerticalAlignment="Bottom" />
                    <StackPanel Grid.Row="5" Orientation="Horizontal">
                        <toolkit:PhoneTextBox Grid.Row="1" 
                                          Hint="验证码" 
                                          Width="180"
                                          Height="74"
                                          InputScope="Number"
                                          Text="{Binding ImgCode, Mode=TwoWay}"
                                          TextChanged="OnCodeChanged"/>
                        <Image Height="50" Source="{Binding CodeSource}"/>

                    </StackPanel>

                </Grid>
            </ScrollViewer>
            <Grid Grid.Row="1" Background="{StaticResource PhoneChromeBrush}" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="180"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="180"/>
                </Grid.ColumnDefinitions>
                <Button Content="登录" Background="#FF1080DD" 
                        Command="{Binding LoginCommand}"/>
                <Button Grid.Column="2" Content="刷新"  
                        Command="{Binding ResetCodeCommand}"/>
            </Grid>
        </Grid>
    </Grid>

</phone:PhoneApplicationPage>